package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.GwStaffEducationMapper;
import com.ruoyi.system.domain.GwStaffEducation;
import com.ruoyi.system.service.IGwStaffEducationService;

import javax.annotation.Resource;

/**
 * 教育经历Service业务层处理
 *
 * @author ruoyi
 * @date 2025-04-27
 */
@Service
public class GwStaffEducationServiceImpl implements IGwStaffEducationService {
    @Resource
    private GwStaffEducationMapper gwStaffEducationMapper;

    /**
     * 查询教育经历
     *
     * @param id 教育经历主键
     * @return 教育经历
     */
    @Override
    public GwStaffEducation selectGwStaffEducationById(String id) {
        return gwStaffEducationMapper.selectGwStaffEducationById(id);
    }

    /**
     * 查询教育经历列表
     *
     * @param gwStaffEducation 教育经历
     * @return 教育经历
     */
    @Override
    public List<GwStaffEducation> selectGwStaffEducationList(GwStaffEducation gwStaffEducation) {
        return gwStaffEducationMapper.selectGwStaffEducationList(gwStaffEducation);
    }

    /**
     * 新增教育经历
     *
     * @param gwStaffEducation 教育经历
     * @return 结果
     */
    @Override
    public int insertGwStaffEducation(GwStaffEducation gwStaffEducation) {
        gwStaffEducation.setId(IdUtils.fastSimpleUUID());
        gwStaffEducation.setCreateTime(DateUtils.getNowDate());
        gwStaffEducation.setUpdateTime(DateUtils.getNowDate());
        return gwStaffEducationMapper.insertGwStaffEducation(gwStaffEducation);
    }

    /**
     * 修改教育经历
     *
     * @param gwStaffEducation 教育经历
     * @return 结果
     */
    @Override
    public int updateGwStaffEducation(GwStaffEducation gwStaffEducation) {
        gwStaffEducation.setUpdateTime(DateUtils.getNowDate());
        gwStaffEducation.setUpdateBy(SecurityUtils.getLoginUser().getUser().getNickName());
        return gwStaffEducationMapper.updateGwStaffEducation(gwStaffEducation);
    }

    /**
     * 批量删除教育经历
     *
     * @param ids 需要删除的教育经历主键
     * @return 结果
     */
    @Override
    public int deleteGwStaffEducationByIds(String[] ids) {
        return gwStaffEducationMapper.deleteGwStaffEducationByIds(ids);
    }

    /**
     * 删除教育经历信息
     *
     * @param id 教育经历主键
     * @return 结果
     */
    @Override
    public int deleteGwStaffEducationById(String id) {
        return gwStaffEducationMapper.deleteGwStaffEducationById(id);
    }

    @Override
    public void deleteByStaffId(String staffId) {
        gwStaffEducationMapper.deleteByStaffId(staffId);
    }
}
